package com.yt.cli.pattern;

public class Client {

    public static void main(String[] args) {
        Device tv = new Device("TV");

        Device stereo = new Device("stereo");

        // 创建具体命令对象，可以绑定不同的设备
        TurnOnCommand turnOn = new TurnOnCommand(tv);
        TurnOffCommand turnOff = new TurnOffCommand(tv);

        // 创建调用者
        RemoteControl remote = new RemoteControl();

        // 执行命令
        remote.setCommand(turnOn);
        remote.pressButton();

        remote.setCommand(turnOff);
        remote.pressButton();
    }
}
